//
//  WBStatusCell.swift
//  ZWWEIBO
//
//  Created by xzw on 2018/4/9.
//  Copyright © 2018年 xzw. All rights reserved.
//

import UIKit

class WBStatusCell: UITableViewCell {
    //头像
    @IBOutlet weak var iconView: UIImageView!
    //姓名
    @IBOutlet weak var nameLab: UILabel!
    //会员图标
    @IBOutlet weak var memberIconView: UIImageView!
    //时间
    @IBOutlet weak var timeLabel: UILabel!
    //来源
    @IBOutlet weak var sourceLab: UILabel!
    
    //认证
    @IBOutlet weak var vipIconView: UIImageView!
    //正文
    @IBOutlet weak var statusLabel: UILabel!
    
    //底部工具栏
    @IBOutlet weak var toolBarView: WBStatusToolBar!
    
    //九宫格视图
    
    @IBOutlet weak var pictureView: WBStatusPictureView!
    
    
    //原创微博没有此控件，可选
    @IBOutlet weak var retweetedLabel: UILabel?
    
    //模型赋值
    var statusViewModel : WBStatusViewModel?{
        didSet{
           
            //头像
            iconView.zw_setImage(urlStr: statusViewModel?.status.user?.profile_image_url, placeholderImage: UIImage(named:"avatar_default_big"), isAvatar: true)
        
            //姓名
            nameLab.text = statusViewModel?.status.user?.screen_name
            
            //正文
            statusLabel.text = statusViewModel?.status.text
            
            //判断mbrank的值，根据值设置属性
            memberIconView.image = statusViewModel?.memberIcon
            
            //认证图标
            vipIconView.image = statusViewModel?.vipIcon
            
            //底部工具栏
            toolBarView.viewModel = statusViewModel
            
            //测试修改九宫格视图高度
            pictureView.viewModel = statusViewModel
            
            
            //设置配置视图的URL数据模型,包含了被转发和原创
            pictureView.urls = statusViewModel?.picURLs
            
            //设置被转发的微博文字
            retweetedLabel?.text = statusViewModel?.retweetedText
        }
    }
   
    override func awakeFromNib() {
        super.awakeFromNib()
        
        //取消选中
        selectionStyle = .none
        
    }

}
